package game;

import java.awt.Graphics2D;
import java.awt.Point;
import java.util.LinkedList;

public class ObjetosCenario extends GameObject {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public boolean fuiClicado;
	public ClientStatus clientStatus;
	public HUD HudObject;
	public boolean RunaDelay = false;
	public int ID;

	public ObjetosCenario(Point position, Point size, int IDtrabalhador) {
		super(position, size);
		clientStatus = new ClientStatus(position, size, 24, new GameObject(position,  new Point ( 50, 50)), IDtrabalhador);
		HudObject = new HUD(23,24, new Point((int)clientStatus.position.getX(), (int)clientStatus.position.getY()),new Point(100,20));
	}
	@Override
	public void Update() {
		
		if(RunaDelay== true)
		{
			HudObject.Update();
			
			if(HudObject.FINISHEDTIME == true)
			{
				RunaDelay = false;
				HudObject.FINISHEDTIME = false;
				clientStatus.activated = false;
				HudObject.RestoreHUD();
			}
		}
		if(clientStatus.activated)
		{
			clientStatus.Update();
		}
		
		super.Update();
	}
	public void setHudSettings(Trabalhadores trabalhador, int ID2)
	{
		HudObject.SetIDIcone(ID2);
		HudObject.SetIDTrabalhador(trabalhador.ID);
		HudObject.SetDelay(trabalhador.returnDelay(ID2), trabalhador.ID);
		RunaDelay = true;
	}
	
	@Override
	public void draw(Graphics2D g2d, Camera camera) {
		// TODO Auto-generated method stub
		
		super.draw(g2d, camera);
		
		if(clientStatus.activated)
		clientStatus.draw(g2d, camera);
		
		if(RunaDelay == true)
			HudObject.Draw(g2d, camera);
	}

}
